import React from "react";
import { Button } from "antd";
import { useSelector,useDispatch } from "react-redux";
import { increment } from "../store/slices/testSlice";
function TestRedux() {
    let count = useSelector(state => state.test.count);
    const dispatch = useDispatch();
    const handleIncrement = () => {
        dispatch(increment(1));
    }
    return (
        <div>
            <h3>计数器：{count}</h3>
            <Button onClick={handleIncrement}>++</Button>
        </div>
    );
}

export default TestRedux;
